home *** CD-ROM | disk | FTP | other *** search
- bOK = @TRUE
- szDial = "<dialupname>"
- szPgmPath = "<pgmpath>"
- szPgmDir = "<pgmdir>"
- bSendMail = <sendmail>
- bEmpty = <empty>
- szErrDesc = ""
- nWait = 5 ; How many minutes to wait for Netscape to finish its work
-
-
- ;Dial our host (unless user is on a direct connect)...
- hConn = 0
- if (szDial <> "")
- hConn = SDialUp (szDial)
- nErr = SGetLastErr ()
- if (!hConn)
- switch nErr
- case @SErrNotFound
- szErrDesc = "Couldn't connect to %szDial% - no such dial-up"
-
- case nErr ; <--default
- szErrDesc = "Couldn't connect to %szDial% - error %nErr%"
- endswitch
- bOK = @FALSE
- goto LogIt
- else
- if (nErr == @SAlready)
- hConn = 0
- endif
- endif
- endif
-
-
- ; Run Netscape & make it do things...
- szTitle = "Netscape"
- if (WinExist (szTitle))
- WinActivate (szTitle)
- else
- DirChange (szPgmDir)
- Run (szPgmPath, "")
- delay (2)
- endif
-
-
- ; Bring up the Mail window (which automatically gets new mail too)...
- SendKeysTo (szTitle, "!wm")
- Delay (10)
-
-
- if (WinExistChild(szTitle, "No new messages"))
- SendKey ("~")
- endif
-
- if (WinExist("Password Entry Dialog"))
- WinClose ("Password Entry Dialog")
- endif
-
-
- ; Send outgoing mail/articles (if chosen)...
- if (bSendMail)
- if (WinExist (szTitle))
- SendKeysTo (szTitle, "!fd")
- endif
- endif
-
-
- ; Wait for nWait minutes, or till user kills off Netscape manually...
- for n=1 to nWait * 6
- if (WinExist (szTitle))
- Delay (10)
- endif
- next n
-
-
- ; If user hit Ctrl+Break, WIL will bring us here...
- :Cancel
-
- ; Hang up...
- :HangUp
- if (hConn)
- nRet = SHangUp (hConn)
- endif
-
-
- ; Empty the trash (if chosen)...
- if (bEmpty)
- if (WinExist (szTitle))
- SendKeysTo (szTitle, "!fe")
- endif
- endif
-
-
- ; Log what we did...
- :LogIt
- if bOK == @TRUE
- szLog = "Ran Netscape"
- else
- szLog = strcat ("Error attempting to automate Netscape:", @CRLF, szErrDesc)
- endif
-
- CMLogMessage (szLog)
- exit
-
- ~
-